const http = require('http');
const fs = require('fs');
const path = require('path')

// 创建http服务
const server = http.createServer((req, res) => {
    const htmlPath = path.resolve(__dirname, 'form.html');
    const rs = fs.createReadStream(htmlPath)

    res.setHeader('content-type', 'text/html;charset=utf-8')
    rs.pipe(res)
    rs.on('end', () => {
        res.end()
    })
})

// 监听9000端口
server.listen(9000, () => {
    console.log('服务启动了');
})